package com.atwisdom.star.controller;

import com.alibaba.fastjson.JSONObject;
import com.atwisdom.star.common.vo.ActionData;
import com.atwisdom.star.common.vo.ResultInfo;
import com.atwisdom.star.core.bsl.basicClass.impl.ScheduleBslServiceImpl;
import com.atwisdom.star.core.dsl.basicClass.impl.ScheduleDslServiceImpl;
import com.atwisdom.star.exception.pojo.BusinessException;
import com.atwisdom.star.log.aop.StarAnnotation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/schedule")
public class ScheduleController {
    private final ScheduleBslServiceImpl scheduleBslService;

    public ScheduleController(ScheduleBslServiceImpl scheduleBslService) {
        this.scheduleBslService = scheduleBslService;
    }

    /**
     *
     * @param actionDataList 接收参数据
     * @return 返回结果
     * @throws BusinessException  业务异常
     */
    @StarAnnotation
    @PostMapping
    public ResultInfo<?> responseScheduleFactory(@RequestBody List<ActionData<JSONObject>> actionDataList) throws BusinessException {
        return scheduleBslService.responseFactory(actionDataList);
    }
}
